﻿using NUnit.Framework;

namespace SharePoint.Orm.Metal {
	[TestFixture]
	public class DefaultNameRewriterTest : TestBase {
		private readonly DefaultNameRewriter _nameRewriter = new DefaultNameRewriter();

		[Test]
		public void TestToTypeName() {
			Assert.AreEqual("Test", _nameRewriter.ToTypeName("Test"));
		}

		[Test]
		public void TestToTypeName_StartsWithNumber() {
			Assert.AreEqual("Test", _nameRewriter.ToTypeName("0Test"));
		}

		[Test]
		public void TestToTypeName_Spaces() {
			Assert.AreEqual("TestSpace", _nameRewriter.ToTypeName("Test space"));
		}

		[Test]
		public void TestToTypeName_SpecialCharacters() {
			Assert.AreEqual("TestIt", _nameRewriter.ToTypeName("Test!@#$%^&*()\"';:<>,./?[]{}\\|it"));
		}

		[Test]
		public void TestToTypeName_EscapedCharacters() {
			Assert.AreEqual("TestIt", _nameRewriter.ToTypeName("Testx0020it"));
		}
	}
}
